{include file="public/header"/}
</head>
<body>
<div class="layui-form">
<div class="layui-fluid" id="LAY-component-layer-list">
<div class="layui-col-md12 pd83">
<div class="layui-card hideshadow">
  <div class="layui-tab layui-tab-brief">
  {include file="web/top"}
  <div class="layui-tab-content">
        <div class="layui-form-item">
          <label class="layui-form-label pcfcms_layui-form-label">移动端域名</label>
          <div class="layui-input-inline auto">
             <input type="checkbox" lay-filter="web_mobile_domain_open" lay-skin="switch" lay-text="开启|关闭" {if condition="!isset($config.web_mobile_domain_open) || $config.web_mobile_domain_open eq 1"}checked{/if}>
             <input type="hidden" name="web_mobile_domain_open" value="{$config.web_mobile_domain_open|default='1'}" />
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label pcfcms_layui-form-label">移动端域名</label>
          <div class="layui-input-inline auto">
              <input type="text" style="width:80px;float:left" name="web_mobile_domain" value="{$config.web_mobile_domain|default='m'}" class="layui-input" lay-verify="required" onKeyUp="this.value=this.value.replace(/[^0-9a-z]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9a-z]/g,''));" placeholder="手机域名">
             <span style="float:left;line-height:38px;margin-left:4px;margin-right:5px;">.{$Request.rootDomain}</span>
          </div>
          <div class="layui-input-inline auto lh38">
              请将二级域名 m 解析到站点根目录下
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label pcfcms_layui-form-label">后台路径</label>
          <div class="layui-input-inline pcfcms_layui-input-inline">
             <input type="hidden" name="adminbasefile_old" value="{$adminbasefile|default='login'}">
             <span style="float:left;line-height:38px;margin-right:4px;">{$Request.domain}/</span>
             <input style="width:100px;float:left" type="text" name="adminbasefile" value="{$adminbasefile|default='login'}" lay-verify="required|check_adminbasefile" class="layui-input" onKeyUp="this.value=this.value.replace(/[^0-9a-zA-Z_-]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9a-zA-Z_-]/g,''));">
             <span style="float:left;line-height:38px;margin-left:4px;margin-right:5px;">.php</span>
          </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label pcfcms_layui-form-label">后台LOGO</label>
            <div class="layui-input-inline auto">
              <ul class="layout">
                <li>
                <input name="web_adminlogo" id="web_adminlogo" placeholder="图片地址" value="{$config.web_adminlogo|default=''}" class="layui-input inp inp_logo">
                <input type="hidden" name="old_web_adminlogo" value="{$config.web_adminlogo|default=''}">
                <img id="img_web_logo" src="{$config.web_adminlogo|get_default_pic=###}?v={php}echo time();{/php}" class="none">
                </li>
                <li style="margin-top:3px;margin-left:5px;">
                  <div class="layui-btn-group">
                    <input type="button" value="上传图片" class="layui-btn layui-btn-sm pcfcms-upload" lay-data="{number:1,pcf_inputId:'web_adminlogo',pcf_savepath:'allimg'}">
                    <input type="button" value="选择图片" class="layui-btn layui-btn-sm" onClick="GetPictureFolder(1,'web_adminlogo');">
                    <input type="button" value="预览" class="layui-btn layui-btn-sm" onclick="BigImages($('#img_web_logo').attr('src'));">
                    <input type="button" value="清除" class="layui-btn layui-btn-sm layui-btn-warm" data-inputid="web_adminlogo" onclick="DelImages(this);">
                  </div>
                </li>
              </ul>
            </div>
        </div>
        
     </div>
  </div>
</div>
<div class="pcfclear"></div>
</div>
<div class="submit-info text-center">
    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
</div>
</div>
</div>
{include file="public/loading"/}
{include file="public/footer"/}
<script type="text/javascript">
    layui.use(['layer', 'form','element'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;

        form.verify({
          check_adminbasefile: function(value, item){
            if(/[^0-9a-zA-Z_-]/.test(value)){return '只允许字母、数字、下划线和连接符等组合！';}
          }
        });

        //监听提交
        form.on('submit(formSubmit)', function(data){
            if(data.field.adminbasefile_old != data.field.adminbasefile){
                var flag = false;
                layer.confirm('后台路径：<font color="red">'+'{$Request.domain}'+'/'+data.field.adminbasefile+'.php</font>，确认更改？', {
                      title: false,
                      btn: ['继续更改','取消']
                    }, function(index){
                      layer.close(index);
                      formSubmit(data);
                    }, function(index){
                      flag = false;
                    }
                );
                return flag;
            }
            formSubmit(data);
        });

        function formSubmit(data){
            layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
            $.ajax({
                type : 'post',
                url : "{:url('/web/web2')}",
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll('loading');
                    if(res.status){
                      layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                          if ('_parent' == res.target) {
                              top.window.location.href = res.url;
                          } else {
                              window.location.reload();
                          }
                      });
                    }else{
                      layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                },
                error: function(e){
                    layer.closeAll('loading');
                    layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                }
            });
        }

        //监听开关
        form.on('switch', function(data){
          var elemId = data.elem.attributes['lay-filter']['nodeValue'];
          if (data.elem.checked) {
            this.value = 1;
          } else {
            this.value = 0;
          }
          $("input[name='"+elemId+"']").val(this.value);
        })

  });
</script>
</body>
</html>